<?php
/**
 * Created by PhpStorm.
 * User: 27394
 * Date: 2016/11/21
 * Time: 15:24
 */
namespace Home\Model;
use Think\Model;

class AdminModel extends Model{
    protected $_validate = array();
    protected $_auto = array();

    public function McheckLogin(){
        $username = I('post.username');//获取post get的值
        $condition = array('name'=>$username);//变成数组
        $result = $this->where($condition)->find(); //查询用户是否存在
        $pwd=md5(I('post.pwd').C('MD5_SALT'));
        if($result['pwd'] == $pwd){//密码比对
            return  $result;
        }
        return false;
    }

    public function GetPowerById(){ //通过ID ，获取权限 及 菜单
        if($_SESSION['ltq_user']['id']){
              return D('power')->getPowerById();
        }else{
            return false;
        }

    }
}